#ifndef _CPLOT_H_
#define _CPLOT_H_

#include <buola/chart.h>

#include <buola/image/ccolor.h>

namespace buola { namespace chart {

class CPlot : public UShared
{
public:
    enum ePointShape
    {
        POINT,              //!< solid point
        SQUARE,             //!< square
        TRIANGLE,           //!< equilateral triangle pointing up
        CIRCLE,             //!< empty circle
        CROSS,              //!< cross
        STAR,               //!< five-pointed star
        X                   //!< x-shaped point
    };

    enum EStyle
    {
        STYLE_NONE=0,
        FILL=(1<<0),        //!< fill under the line
        POINTS=(1<<1),      //!< draw the data points
        LINE=(1<<2),        //!< draw a line joining the points
        POINTFILL=(1<<3),   //!< fill the points (if the shape allows it
        STEM=(1<<4),        //!< draw a line from the x axis to the point
        HULL=(1<<5),        //!< draw the convex hull around the data points
        MESH=(1<<6),
        DISABLED=(1<<16)
    };
    DECLARE_FRIEND_ENUM_BITOPS(EStyle)
    
    class SPointDrawer
    {
    public:
        SPointDrawer(img::CGC *pGC,ePointShape pShape,EStyle pStyle);
        ~SPointDrawer();

        void Draw(const CPoint_d &pPos);

        void SetLineWidth(double pWidth);
        void SetColor(const img::CColor &pColor);
        void SetFillColor(const img::CColor &pColor);
        void SetDiameter(double pDiameter);

    private:
        img::CGC *mGC;
        ePointShape mShape;
        double mDiameter;
        img::CColor mColor;
        img::CColor mFillColor;
        EStyle mStyle;
    };

public:
    CPlot();
    virtual ~CPlot();

    void SetStyle(EStyle pStyle);
    EStyle GetStyle()   {   return mStyle;  }

    virtual const std::wstring &GetName()  {   return mName;  }
    virtual void SetName(const std::wstring &pName) {   mName=pName;   }

public:
/////////////// interface /////////////////

protected:
////////////// Event handling //////////////
    EStyle mStyle;
    std::wstring mName;
};

/*namespace chart*/ } /*namespace buola*/ }

#endif
